home *** CD-ROM | disk | FTP | other *** search
- /*
- File: TBitmap.h
-
- Contains: A simple bitmap class
-
- Written by: Arno Gourdol
-
- Copyright: © 1996 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #pragma once
-
- #ifndef __TBITMAP__
- #define __TBITMAP__
-
- #include "assert.h"
-
- #include <Quickdraw.h>
- #include <QDOffscreen.h>
-
- #include "TDrawContext.h"
-
- class TBitmap : public TDrawContext
- {
- public:
- TBitmap(SInt16 pictureID, UInt16 depth);
- TBitmap(CRect bounds, UInt16 depth);
- ~TBitmap();
-
- void SetBits(const void* data, UInt32 length, UInt32 offset, UInt16 depth);
- void* Bits(void) const;
- long BitsLength(void) const;
- long BytesPerRow(void) const;
- UInt16 ColorSpace(void) const;
- virtual CRect Bounds(void) const;
- virtual Boolean Lock(void);
- virtual void Unlock(void);
- inline PixMapHandle GetPixMapHandle(void) const;
- inline GWorldPtr GetGWorldPtr(void) const;
- private:
- UInt16 fRowBytes;
- GDHandle fSaveGDevice;
- GWorldPtr fGWorld;
- CRect fBounds;
- UInt16 fDepth;
- };
-
- inline GWorldPtr TBitmap::GetGWorldPtr(void) const
- {
- return fGWorld;
- }
-
-
- inline PixMapHandle TBitmap::GetPixMapHandle(void) const
- {
- return ::GetGWorldPixMap(fGWorld);
- }
-
-
- #endif